package com.hmkj.core.mapper.userBank;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.model.user.UserBankModel;
import com.hmkj.core.po.userBank.UserBank;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 用户绑卡记录相关Dao接口<br>
 *
 * @author lizhijie
 * @date   2018-07-04 04:37:45
 */
public interface UserBankMapper extends GenericMapper< UserBank,Integer> {

    @Select("SELECT t.*,a.realname AS 'a.realname',u.mobile_phone AS 'u.mobilePhone' FROM biz_user_bank t LEFT JOIN biz_user u ON t.user_id = u.id LEFT JOIN biz_user_auth a ON a.user_id = u.id WHERE 1=1 ${whereSql} ${sortSql} limit ${nowPage}, ${pageSize} ")
    List<UserBankModel> findListBySqlJoin(Map<String, Object> params);

    @Select("SELECT count(1) FROM biz_user_bank t LEFT JOIN biz_user u ON t.user_id = u.id LEFT JOIN biz_user_auth a ON a.user_id = u.id WHERE 1=1 ${whereSql}")
    long countBySqlJoin(Map<String, Object> params);
}
